import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import cesium from 'vite-plugin-cesium';
import path from 'path';
import AutoImport from 'unplugin-auto-import/vite';
import md from './public/plugins/vite-plugin-markdown';

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [
        vue(),
        cesium(),
        md(),
        AutoImport({
            // 自动导入 Vue 相关函数，如：ref, reactive, toRef 等
            imports: ['vue'],
        }),
    ],
    server: {
        port: 5173,
        host: true,
        open: true,
        proxy: {
            '/d3tile1': {
                target: 'http://10.0.19.131:8080',
                changeOrigin: true,
                rewrite: p => p.replace(/^\/d3tile1/, ''),
            },
        },
    },
    resolve: {
        alias: {
            '@': path.resolve(__dirname, 'src'),
        },
    },
});
